﻿using Douban.Api.Infrastructure;

namespace Douban.Api.User
{
    [Entry]
    public class UserDetail : EntryItem
    {
        private string _selfDescription;

        [Element("title")]
        public string Name { get; set; }

        [Link("alternate")]
        public string DoubanPage { get; set; }

        [Link("homepage")]
        public string HomePage { get; set; }

        [Link("icon")]
        public string IconUri { get; set; }

        [Element("location", NsManager.Douban)]
        public string Location { get; set; }

        [Element("uid", NsManager.Douban)]
        public string Uid { get; set; }

        [Element("signature", NsManager.Douban)]
        public string Signature { get; set; }

        [Element("content")]
        public string SelfDescription 
        {
            get 
            {
                if (string.IsNullOrEmpty(_selfDescription))
                    return "什么也没有";
                return _selfDescription; 
            }
            set 
            {
                if (value != null)
                    value = value.Trim();

                _selfDescription = value; 
            }
        }

        [Id]
        public string Id { get; set; }
    }
}
